package com.jule.miaozhuapc.service.impl;

import com.jule.miaozhuapc.dao.CheckTodayDao;
import com.jule.miaozhuapc.dao.PayConfigDao;
import com.jule.miaozhuapc.dao.UserDao;
import com.jule.miaozhuapc.domain.WawaPayConfig;
import com.jule.miaozhuapc.domain.WawaUser;
import com.jule.miaozhuapc.dto.PayConfigDto;
import com.jule.miaozhuapc.dto.UserDto;
import com.jule.miaozhuapc.req.dto.WxUserInfo;
import com.jule.miaozhuapc.service.PayConfigService;
import com.jule.miaozhuapc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;


@Service
@Transactional
public  class PayConfigServiceImpl implements PayConfigService {

	@Autowired
	PayConfigDao payConfigDao;

	@Override
	public List<PayConfigDto> findAll() {
		List<WawaPayConfig> wawaPayConfigs = payConfigDao.findAll();

		List<PayConfigDto> list = new ArrayList<>();
		if (wawaPayConfigs != null && wawaPayConfigs.size() > 0){

			for (WawaPayConfig wawaPayConfig : wawaPayConfigs){
				PayConfigDto payConfigDto = new PayConfigDto();
				payConfigDto.setCoin(wawaPayConfig.getCoin());
				payConfigDto.setMoney((Double) wawaPayConfig.getMoney());
				payConfigDto.setPayConfigId(wawaPayConfig.getId());
				payConfigDto.setRemark(wawaPayConfig.getRemark());
				list.add(payConfigDto);
			}

		}
		return list;
	}
}
